<?php

declare(strict_types=1);

namespace App\Master\Framework\Library\Extend;

use Hyperf\HttpServer\Contract\RequestInterface;

class Core{

    /**
     * @var RequestInterface
     */
    protected RequestInterface $request;

    public function __construct(RequestInterface $request)
    {
        $this->request = $request;
    }

    public function getLocalUrl(string $path = '')
    {

        var_dump($this->request->getRequest()->getUri());
        // 返回完整的本地链接地址
        return $this->request->getRequest()->getUri()->getScheme() . '://' . $this->request->getRequest()->getUri()->getHost() . '/' . $path;
    }
}